﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using cmdb.keede.entity;

namespace cmdb.keede.data
{
    public class UnitOfWork : IUnitOfWork
    {
        private CMDBContext _dataContext;

        public UnitOfWork(CMDBContext dataContext)
        {
            this._dataContext = dataContext;
        }

        //protected CMDBContext DataContext => dataContext ?? (dataContext = databaseFactory.Get());

        public void Commit()
        {
            _dataContext.SaveChanges();
        }

        public async Task CommitAsync()
        {
            await _dataContext.SaveChangesAsync();
        }
    }
}
